package com.example.asapp.demo.code;


import com.example.asapp.demo.code.vo.EntityVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;


@RestController
@Slf4j
@RequestMapping("/api/demo/code")
public class CodeApi {

    @Autowired
    CodeService codeService;

    @PostMapping("getEntity")
    public EntityVO getEntity(@RequestBody EntityVO entityVO){
        return codeService.getEntity(entityVO);
    }

    @PostMapping("setCode")
    public void setDemoCode(@RequestBody EntityVO entityVO) throws IOException {
        log.info("获取的entityVO:{}",entityVO);
        codeService.setCode(entityVO);

    }
}
